package com.joysuch.wwyt.datadump.biz.query;

import cn.zlg.common.datadump.condition.QueryCondtionDef;
import cn.zlg.common.datadump.condition.QueryFieldCondition;
import cn.zlg.common.datadump.condition.SortFieldDef;
import com.joysuch.wwyt.risk.entity.dsl.QRiskPoint;
import com.querydsl.core.types.Order;

/**
 * @Author ZhaoQiuWei
 * @Date 2021/10/26 11:15
 */
public class RiskPointDumpQueryBean implements QueryCondtionDef {


    @Override
    public QueryFieldCondition[] getAllConditionDef() {
        return new QueryFieldCondition[] {
                new QueryFieldCondition("ids", QRiskPoint.riskPoint,
                        QRiskPoint.riskPoint.id, QRiskPoint.riskPoint.id, "in"),
                new QueryFieldCondition("name", QRiskPoint.riskPoint,
                        QRiskPoint.riskPoint.name, QRiskPoint.riskPoint.id,
                        "contains"), };
    }

    @Override
    public SortFieldDef[] getAllSortFieldDef() {
        return new SortFieldDef[] {
                new SortFieldDef(QRiskPoint.riskPoint.id, "id", Order.DESC, true),
                new SortFieldDef(QRiskPoint.riskPoint.name, "name", Order.ASC) };
    }

//    private Predicate getPredicate(){
//        QRiskPoint point = QRiskPoint.riskPoint;
//        Predicate p = null;
//        p = ExpressionUtils.and(p, ExpressionUtils.or(point.state.notIn(DataStateTypes.DELETE.getState()),
//                point.state.isNull()));
//        p = ExpressionUtils.and(p, ExpressionUtils.or(point.shared.isNull(), point.shared.eq(0)));
//        p = ExpressionUtils.and(p, point.status.eq(RiskPointStatus.AUDIT_SUCCESS.getIndex()));
//      return p;
//    }

}
